﻿using UnityEngine;
using System.Collections;

public class zoneAudioController : MonoBehaviour {
	public GameObject player;
	public AudioClip clip1;
	public AudioClip clip2;
	public AudioSource src;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		if ((player.transform.position.x > -10) && (player.transform.position.x < 10) && (player.transform.position.z > -10) && (player.transform.position.z < 10) && src.audio.clip == clip2)
		{
			src.audio.clip = clip1;
			src.audio.Play();
		} else if ((player.transform.position.x < -10 || player.transform.position.x > 10 || player.transform.position.z < -10 || player.transform.position.z > 10) && src.audio.clip == clip1){
			//src.audio.clip = clip2;
			//src.audio.Stop();
		}
	}
}
